//
//  YSOnlineRechargeViewController.m
//  YouSheng
//
//  Created by Mac on 16/9/1.
//  Copyright © 2016年 FanShuHan. All rights reserved.
//

#import "YSOnlineRechargeViewController.h"
#import "ChongZhiView.h"
#import <Masonry.h>

#define YSBJColorLan [UIColor colorWithRed:78/255.0 green:204/255.0 blue:190/255.0 alpha:1]
#define YSBJColorHui [UIColor colorWithRed:239/255.0 green:239/255.0 blue:239/255.0 alpha:1]

@interface YSOnlineRechargeViewController ()

@end

@implementation YSOnlineRechargeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = YSBJColorHui;
    self.title = self.navTitle;
    self.haoma = 13312345678;
    self.qian = 100;
    
    [self setupUI];

}

//UI搭建
- (void)setupUI {
    //余额
    UILabel *yueLab = [[UILabel alloc] init];
    yueLab.text = @"余额";
    yueLab.textColor = [UIColor grayColor];
    yueLab.font = [UIFont systemFontOfSize:20];
    
    [self.view addSubview:yueLab];
    
    [yueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(84);
        make.centerX.equalTo(self.view);
        
    }];
    
    //手机号码
    UILabel *numLab = [[UILabel alloc] init];
    numLab.text = [NSString stringWithFormat:@"绑定号码: %.0f",self.haoma];
    numLab.textColor = [UIColor grayColor];
    numLab.font = [UIFont systemFontOfSize:14];
    
    [self.view addSubview:numLab];
    
    [numLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(yueLab.mas_bottom).offset(15);
        make.centerX.equalTo(self.view);
    }];
    
    //余额数值
    UILabel *qianLab = [[UILabel alloc] init];
    qianLab.text = [NSString stringWithFormat:@"%.2f",self.qian];
    qianLab.textColor = YSBJColorLan;
    qianLab.font = [UIFont systemFontOfSize:40];
    
    [self.view addSubview:qianLab];
    
    [qianLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(numLab.mas_bottom).offset(25);
        make.centerX.equalTo(self.view);
    }];
    
        //套餐充值
        UILabel *tcLab = [[UILabel alloc] init];
        tcLab.text = @"套餐充值";
        tcLab.textColor = [UIColor grayColor];
        tcLab.font = [UIFont systemFontOfSize:18];
    
        [self.view addSubview:tcLab];
    
        [tcLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(qianLab.mas_bottom).offset(30);
            make.centerX.equalTo(self.view);
        }];
    
        //创建中间充值view
        ChongZhiView *czView = [ChongZhiView chongZhiView];
        
        [self.view addSubview:czView];
        
        [czView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(tcLab.mas_bottom).offset(10);
            make.left.equalTo(self.view).offset(20);
            make.right.equalTo(self.view).offset(-20);
            make.height.mas_equalTo(200);
        }];

    
    //充值按钮
    UIButton *czBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    czBtn.layer.cornerRadius = 5;
    [czBtn setTitle:@"充值" forState:UIControlStateNormal];
    [czBtn setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted];
    [czBtn setBackgroundColor:YSBJColorLan];
    
    [czBtn addTarget:self action:@selector(czBtnClick) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:czBtn];
    
    [czBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view.mas_bottom).offset(-64);
        make.left.equalTo(self.view).offset(20);
        make.right.equalTo(self.view).offset(-20);
        make.height.mas_equalTo(44);
    }];

}


//充值按钮点击
- (void)czBtnClick {
    NSLog(@"点击了充值按钮");
}


@end
